import React, {Component, createRef} from 'react';

class UncontrolledComponents extends Component {
    myUserName=createRef();
    render() {
        return (
            <div>
                <div>登录页</div>
                <input type={"text"} ref={this.myUserName} defaultValue={"UN"}/>
                <button onClick={()=>{
                    console.log(this.myUserName.current.value)
                }}>登录</button>
                <button  onClick={()=>{
                    this.myUserName.current.value="";
                }}>重置</button>
            </div>
        );
    }
}

export default  UncontrolledComponents;
